﻿<?xml version="1.0" encoding="utf-8" ?>
<Mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	
	<!-- 
		Les entités sont décrite spécifiquement
			- leurs attributs sont génériques
			- et leurs relations sont spécifiques
	-->
	
	<Entity type="ValueTypes" table="ValueTypes">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>
	
	<Entity type="Person" table="Person">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
		
		<Reference name="Prout" entityChild="Person">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Person" childField="Id" />
		</Reference>
		
		<Reference name="Partners" entityChild="Person">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Person" childField="Id" />
		</Reference>
		
		<Reference name="Brother" entityChild="Person">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Person" childField="Id" />
		</Reference>
		
		<Reference name="Friends" entityChild="Thing">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Thing" childField="Id" />
		</Reference>
		
		<Reference name="MyCompany" entityChild="Company">
			<Rule parentField="Id" childTable="IndexTable" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Company" childField="Id" />
		</Reference>
	</Entity>
	
	<Entity type="Thing" table="Thing">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>
	
	<Entity type="ComplexTypes" table="ComplexTypes">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>
	
	<Entity type="FlaggedCategory" table="FlaggedCategory">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>
	
	<Entity type="Category" table="Category">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>
	
	<Entity type="SerializableTypes" table="SerializableTypes">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>
	
	<Entity type="Manager" table="Manager">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
		<Reference name="MyCompany" entityChild="Company">
			<Rule parentField="FK_Company" childTable="Company" childField="Id" />
		</Reference>
	</Entity>
	
	<Entity type="Company" table="Company">
		<Id field="Id" ><Generator name="guid" /></Id>
		<Attribute name="*" table="Attribute" field="Value"	type="*" db-type="AnsiString" 
			size="1024" parentField="FK_Entity" discriminator="Name" discriminator-value="*" />
	</Entity>

</Mapping>